<?php
	include dirname(dirname(dirname(__FILE__))).'/admin-verify.php';
	include dirname(dirname(__FILE__)).'/functions.php';
	$apply_id=base64_decode(addslashes($_POST["param1"]));
	$ret=getEmployApplyById($apply_id);
	if ($ret!=null) {
		$params= array('status' =>1);
		if(updateEmployApply($params,$ret["ea_id"])){

			$params=array('is_on_work' =>1 );
			if(updateS_user($params,$ret["id"])){
				$params=array('username' =>'"'.$ret["username"].'"' ,
								'password'=>'"'.$ret["password"].'"',
								'student_id'=>'"'.$ret["student_id"].'"',
								'sex'=>'"'.$ret["sex"].'"',
								 'grade'=>'"'.$ret["grade"].'"',
								 'department'=>'"'.$ret["department"].'"',
								 'user_real_name'=>'"'.$ret["user_real_name"].'"',
								 'phone'=>'"'.$ret["phone"].'"',
								 'user_role'=>'"'.'user'.'"');
				if (addUser($params)) {
					echo "yes";
					exit();
				}
				echo "no";
					exit();

			}
			echo "no";
				exit();

		}
		echo "no";
			exit();
		
		

	}
	echo "no";

?>